import React from 'react';
import App from 'next/app';
import Layout from '../components/layout';
import withRedux from 'next-redux-wrapper';
import withReduxSaga from 'next-redux-saga';
import { Provider } from 'react-redux';
import createStore from '../store';
import 'antd/dist/antd.css';
class MyApp extends App {
    static async getInitialProps({ Component, ctx }) {
        let pageProps = {};
        if (Component.getInitialProps) {
            pageProps = await Component.getInitialProps(ctx);
        }
        return { pageProps };
    }
    render() {
        const { Component, pageProps, store } = this.props;
        return (
            <>
                <Provider store={store}>
                    <Layout title={pageProps.title}>
                        <Component {...pageProps} />
                    </Layout>
                </Provider>
            </>
        );
    }
}

export default withRedux(createStore)(withReduxSaga(MyApp));
